package com.tencent.sr.iris.basic.saas.dependency.station;

import com.alibaba.fastjson.JSON;
import com.tencent.sr.iris.basic.saas.common.utils.HttpUtils;
import com.tencent.sr.iris.basic.service.interfaces.client.station.StationMessageClient;
import com.tencent.sr.iris.basic.service.interfaces.request.station.StationMessageBasicRequest;
import com.tencent.sr.iris.basic.service.interfaces.request.station.StationMessageDetailRequest;
import com.tencent.sr.iris.basic.service.interfaces.request.station.StationMessagePageRequest;
import com.tencent.sr.iris.basic.service.interfaces.request.station.StationMessageSaveRequest;
import com.tencent.sr.iris.basic.service.interfaces.request.station.StationMessageUpdateRequest;
import com.tencent.sr.iris.basic.service.interfaces.response.station.StationMessageDetailResponse;
import com.tencent.sr.iris.basic.service.interfaces.response.station.StationMessagePageResponse;
import com.tencent.sr.rmall.common.primitive.HttpResult;
import com.tencent.sr.rmall.common.request.PaginationRequest;
import com.tencent.sr.rmall.common.response.PaginationResponse;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class StationMessageDependency {
    @Resource
    private StationMessageClient stationMessageClient;


    public PaginationResponse<StationMessagePageResponse> page(
            PaginationRequest<StationMessagePageRequest> request) {
        log.info("StationMessageDependency.page调用，入参：{}", JSON.toJSONString(request));
        HttpResult<PaginationResponse<StationMessagePageResponse>> result = stationMessageClient.page(request);
        return HttpUtils.handleResult(result);
    }

    public Boolean insert(StationMessageSaveRequest request) {
        log.info("StationMessageDependency.insert调用，入参：{}", JSON.toJSONString(request));
        HttpResult<Boolean> result = stationMessageClient.insert(request);
        return HttpUtils.handleResult(result);
    }

    public StationMessageDetailResponse detail(StationMessageBasicRequest request) {
        log.info("StationMessageDependency.detail调用，入参：{}", JSON.toJSONString(request));
        HttpResult<StationMessageDetailResponse> result = stationMessageClient.detail(request);
        return HttpUtils.handleResult(result);
    }

    public Boolean delete(StationMessageBasicRequest request) {
        log.info("StationMessageDependency.delete调用，入参：{}", JSON.toJSONString(request));
        HttpResult<Boolean> result = stationMessageClient.delete(request);
        return HttpUtils.handleResult(result);
    }

    public Boolean publish(StationMessageBasicRequest request) {
        log.info("StationMessageDependency.publish调用，入参：{}", JSON.toJSONString(request));
        HttpResult<Boolean> result = stationMessageClient.publish(request);
        return HttpUtils.handleResult(result);
    }

    public Boolean update(StationMessageUpdateRequest request) {
        log.info("StationMessageDependency.update调用，入参：{}", JSON.toJSONString(request));
        HttpResult<Boolean> result = stationMessageClient.update(request);
        return HttpUtils.handleResult(result);
    }

    public StationMessageDetailResponse detailByMessageId(StationMessageDetailRequest request) {
        log.info("StationMessageDependency.detailByMessageId调用，入参：{}", JSON.toJSONString(request));
        HttpResult<StationMessageDetailResponse> result = stationMessageClient.detailByMessageId(request);
        return HttpUtils.handleResult(result);
    }


}
